/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package factory;

import java.util.ArrayList;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;

/**
 *
 * @author wida46984148
 */
public class aux {

    ArrayList<NauBase> anb = new ArrayList<NauBase>();
    ArrayList<NauEnemiga0> anbE = new ArrayList<NauEnemiga0>();
    ArrayList<MoveShoot> sb = new ArrayList<MoveShoot>();
    

    public void posicionaUnitatAmiga(float x, float y, NauBase nb) {
        nb.setLocation((float) x, (float) y);
        anb.add(nb);
    }

    public void posicionaUnitatEnemiga(NauBase nbE) {
        nbE.setLocation(nbE.posX, nbE.posY);
        anbE.add((NauEnemiga0) nbE);
    }

    public void posShoot(float x, float y, MoveShoot s) {
        s.setLocation(x, y);
        sb.add(s);
    }

//    public void posShootE(float x, float y, shootE s) {
//        s.setLocation(x, y);
//        sbe.add(s);
//
//    }

    public void dibuixar(Graphics g, GameContainer gc) {
        try {
            for (NauBase n : anb) {
                if (n != null) {
                    n.render(gc, g);
                }
            }
            for (NauBase n : anbE) {
                if (n != null) {
                    n.render(gc, g);
                }
            }
            for (MoveShoot n : sb) {
                if (n != null) {
                    n.render(gc, g);
                }
            }

        } catch (Exception e) {
        }
    }

    private void accio(int delta) {
        try {
            for (MoveShoot n : sb) {
                if (n != null) {
                    n.update(delta);
                }
            }
            for (NauEnemiga0 n : anbE) {
                if (n != null) {
                    n.update(delta);
                }
            }

        } catch (Exception e) {
        }
    }

//    private void gameEnd(boolean gameE){
//        if (gameE){
//
//        }
//    }
    public void update(int delta) {
        accio(delta);
    }
}
